home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
UTILITY
/
TASEXAM6.ARJ
/
SLOPE.TAS
< prev
next >
Wrap
Text File
|
1992-04-25
|
5KB
|
108 lines
{SLOPE ver 2.0}
{This script REQUIRES THE GRAPHICS FUNCTION
}
{This script is based on Forecasting Tommorows Trading Day -
Technical Analysis of Stocks and Commodities - May Issue.
}
{Rules :
1. Use the forecast only if correlation is above .1, the higher
the reading the greater the confidence.
2. A trend change is imminent when the correlation index falls
below .1.
3. A trend is in place when the correlation index is above .6, you
can wait for this to avoid being whipsawed.
4. An early warning of a trend change is given when the frequency
oscillator crosses the 0 line. Prepare to tighten positions.
5. A change in trend is confirmed by a change in slope. Open
positions in the direction of the trend.
6. The trend will normally change in the direction of f%.
7. Always be prepared for a market move against the forecast,
USE STOPS!
}
{Written by : Steve Hedlund 818-368-2897
}
{=====================================================================}
{SET UP STARTING VARIABLES}
{=====================================================================}
#max_quotes 50
QS=50; {SET SAME AS MAX QUOTES}
LN :=5; {REGRESSION PERIOD}
{=====================================================================}
{SET UP ARRAYS AND VARIABLES}
{=====================================================================}
hx : array; {Linreg array}
hx1 : array; {Forecast array}
hx3 : array; {Oscillator }
hX4 : ARRAY; {Move Forecast ahead 1 day}
hX6 : ARRAY; {Correlation array}
hcon: array; {Stores the Constant of the linreg}
hxx : array; {Slope array}
cx : array; {Linreg array}
cx1 : array; {Forecast array}
cx3 : array; {Oscillator }
cX4 : ARRAY; {Move Forecast ahead 1 day}
cX6 : ARRAY; {Correlation array}
ccon: array; {Stores the Constant of the linreg}
cxx : array; {Slope array}
lx : array; {Linreg array}
lx1 : array; {Forecast array}
lx3 : array; {Oscillator }
lX4 : ARRAY; {Move Forecast ahead 1 day}
lX6 : ARRAY; {Correlation array}
lcon: array; {Stores the Constant of the linreg}
lxx : array; {Slope array}
ST=0; {first day for linreg - changed by loop}
lt=ln {last day for linreg - changed by loop}
gt:=(qs-ln-1)*(-1); {skip the days at the start of linreg}
{=====================================================================}
{CHECKS}
{=====================================================================}
if quote_count<qs then return;
{=====================================================================}
{LINEAR REGRESSION - APROXIMATE LINE
{=====================================================================}
for i=lt;i<=qs;i=i+1;
BEGIN
cX[I] := LINREG(c,ST,LT);
ccon[i] := p[(lt-(ln-1))] {MARTIN - THIS IS WHAT I NEEDED TO DO
}
cxx[i] := SLOPE(LINREG(c,ST,LT)); {TO GET CONSTANT FROM LINREG}
cx6[i] := CORRCOEF()/100;
cx1[i] := ccon[i]+(cxx[I]*(LN+1)); {compute forecast}
hX[I] := LINREG(h,ST,LT);
Hcon[i] := p[(lt-(ln-1))]; {Get Constant from Linreg}
hxx[i] := SLOPE(LINREG(h,ST,LT));
hx6[i] := CORRCOEF()/100;
hX1[i] := hcon[i]+(hXX[I]*(LN+1)); {compute forecast}
lX[I] := LINREG(l,ST,LT);
lcon[i] := p[(lt-(ln-1))]
lxx[i] := SLOPE(LINREG(l,ST,LT));
lx6[i] := CORRCOEF()/100;
lX1[i] := lcon[i]+(lXX[I]*(LN+1)); {compute forecast}
ST=ST+1;
LT=LT+1;
END;
{=====================================================================
CALCULATE OSCILLATORS
======================================================================}
for i=1;i<=(qs);i=i+1;
begin
cx3[i] := ((c[i]-cx1[(i-1)])/c[i])*100;
cx4[i] := cx1[(i-1)];
hx3[i] := ((h[i]-hx1[(i-1)])/h[i])*100;
hx4[i] := hx1[(i-1)];
lx3[i] := ((l[i]-lx1[(i-1)])/l[i])*100;
lx4[i] := lx1[(i-1)];
end;
{=====================================================================}
{GRAPHS}
{=====================================================================}
opengraph(4,gt);
sizegraph(2,1,1,1);
graph(1,cx4,format(cx1[0],'Tomorrows Close %5.2f'),hx4,format(hx1[0],
'Tomorrows Hi %5.2f'),lx1,format(lx1[0],'Tomorrows Low %5.2f'));
GRAPH(cX3,'FREQUENCY OSCILLATOR - Close',hx3,'Hi',Lx3,'Low');
GRAPH(cX6,'CORRELATION INDEX - Close',hx6,'Hi',lx6,'Low');
GRAPH(cXx,'SLOPE - Close',hxx,'Hi',lxx,'Low');
closegraph();